package com.example.sys.async.controller;

import com.example.core.utils.IdGenerator;
import com.example.sys.async.enums.SysASyncType;
import com.example.sys.async.po.SysASync;
import com.example.sys.async.service.SysASyncService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("anon")
@RestController
public class SysASyncAnonController {

    @Resource
    private SysASyncService sysASyncService;

    @RequestMapping("addMQInfo")
    public String addMQInfo() throws Exception {
        String id = IdGenerator.generateStringId();
        SysASync sysASync = new SysASync();
        sysASync.setType(SysASyncType.MQ);
        sysASync.setTarget("xxxx");
        sysASync.setContext(id);
        sysASyncService.add(sysASync);
        return id;
    }
}
